import fetch from './fetch'

const memberService = {}

/**
 * 获取用户信息
 * POST /API/Member/MemberInfo
 * params = {
 * "uid":"用户id"
 * }
 */
memberService.MemberInfo = function (params) {
  return fetch({
    url: 'Member/MemberInfo',
    method: 'post',
    data: params
  })
}

/*
  绑定手机
  POST /API/Member/BindMobile
  params = {
    "uid":"用户id",
    "mobile":"手机号"
  }
*/
memberService.BindMobile = function (params) {
  return fetch({
    url: 'Member/BindMobile',
    method: 'POST',
    data: params
  })
}

/*
  获取公会信息
  POST /API/Member/GuildInfo
  params={"uid":"用户id"}
*/
memberService.GuildInfo = function (params) {
  return fetch({
    url: 'Member/GuildInfo',
    method: 'POST',
    data: params
  })
}

/*
  创建公会
  POST /API/Member/AddGuild
  params = {
    "uid":"用户id",
    "name":"公会名称"
  }
*/
memberService.AddGuild = function (params) {
  return fetch({
    url: 'Member/AddGuild',
    method: 'post',
    data: params
  })
}

/*
  获取公会动态
  POST /API/Member/GuildTrendList
  params = {
    "uid":"用户id",
    "page":"页码,默认第一页",
    "pagesize":"页大小,默认十条"
  }
*/
memberService.GuildTrendList = function (params) {
  return fetch({
    url: 'Member/GuildTrendList',
    method: 'post',
    data: params
  })
}

/*
  获取公会成员
  POST /API/Member/GuildMember
  params = {
    "uid":"用户id",
    "name":"公会名称"
  }
*/
memberService.GuildMember = function (params) {
  return fetch({
    url: 'Member/GuildMember',
    method: 'post',
    data: params
  })
}

/*
  获取公会申请列表
  POST /API/Member/GuildApplyList
  params = {
    "uid":"用户id"
  }
*/
memberService.GuildApplyList = function (params) {
  return fetch({
    url: 'Member/GuildApplyList',
    method: 'post',
    data: params
  })
}

/*
  公会踢人
  POST /API/Member/RemoveMember
  params = {
    "uid":"用户id",
    "rid":"被踢用户id"
  }
*/
memberService.RemoveMember = (params) => {
  return fetch({
    url: 'Member/RemoveMember',
    method: 'post',
    data: params
  })
}

/*
  主动退出公会
  POST /API/Member/ExitGuild
  params = {
    "uid":"用户id"
  }
*/
memberService.ExitGuild = function (params) {
  return fetch({
    url: 'Member/ExitGuild',
    method: 'post',
    data: params
  })
}

/*
  操作入会申请
  POST /API/Member/EditApply
  params = {
    "用户id":"",
    "oid":"申请id",
    "operate":"1.同意 2.拒绝"
  }
*/
memberService.EditApply = function (params) {
  return fetch({
    url: 'Member/EditApply',
    method: 'post',
    data: params
  })
}

/*
  赠送欢乐豆
  POST /API/Member/SendPoints
  params = {
    "uid":"用户id",
    "rid":"接收者用户id",
    "amount":"欢乐豆数量"
  }
*/
memberService.SendPoints = function (params) {
  return fetch({
    url: 'Member/SendPoints',
    method: 'post',
    data: params
  })
}

/*
  欢乐豆纪录列表
  POST /API/Member/PointRecords
  params = {
    "uid":"用户id",
    "page":"页码,默认第一页",
    "pagesize":"页大小,默认十条"
  }
*/
memberService.PointRecords = function (params) {
  return fetch({
    url: 'Member/PointRecords',
    method: 'post',
    data: params
  })
}

/*
  欢乐豆明细
  POST /API/Member/PointDetail
  params = {
    "uid":"用户id",
    "oid":"纪录id"
  }
*/
memberService.PointDetail = function (params) {
  return fetch({
    url: 'Member/PointDetail',
    method: 'post',
    data: params
  })
}

/*
  公会消耗设置
  POST /API/Member/SetConsume
  params = {
    "uid":"用户id",
    "first":"大赢家比例",
    "second":"二赢家比例",
    "third":"三赢家比例"
  }
*/
memberService.SetConsume = function (params) {
  return fetch({
    url: 'Member/SetConsume',
    method: 'post',
    data: params
  })
}

/*
  赠送房卡
  POST /API/Member/SendRoomCard
  params = {
    "uid":"用户id",
    "rid":"接收者用户id",
    "amount":"房卡数量"
  }
*/
memberService.SendRoomCard = (params) => {
  return fetch({
    url: 'Member/SendRoomCard',
    method: 'post',
    data: params
  })
}

/*
  房卡赠送纪录
  POST /API/Member/SendCardRecords
  params = {
    "uid":"用户id",
    "page":"页码,默认第一页",
    "pagesize":"页大小,默认十条"
  }
*/
memberService.SendCardRecords = function (params) {
  return fetch({
    url: 'Member/SendCardRecords',
    method: 'post',
    data: params
  })
}

/*
  房卡统计
  POST /API/Member/CardRecords
  params = {
    "uid":"用户id",
    "page":"页码,默认第一页",
    "pagesize":"页大小,默认十条"
  }
*/
memberService.CardRecords = function (params) {
  return fetch({
    url: 'Member/CardRecords',
    method: 'post',
    data: params
  })
}

/*
  房卡明细
  POST /API/Member/CardDetail
  params = {
    "uid":"用户id",
    "oid":"纪录id"
  }
*/
memberService.CardDetail = function (params) {
  return fetch({
    url: 'Member/CardDetail',
    method: 'post',
    data: params
  })
}

/*
  房卡明细
  POST /API/Member/ShareConfig
  params = {
    "url":"当前页面url"
  }
*/
memberService.ShareConfig = function (params) {
  return fetch({
    url: 'Member/ShareConfig',
    method: 'post',
    data: params
  })
}

export default memberService
